<?php
$db->SetQuery("SELECT uid,username FROM #@__group_user WHERE gid='{$id}' ORDER BY jointime DESC LIMIT 0,8");
$db->Execute();
$newmenber = '';
while($rs = $db->GetArray()){
	$newmenber .= "<li><a href='{$cfg_member_dir}/index.php?id=".$rs['uid']."' target=\"_blank\">".$rs['username']."</a></li>\n";
}
//Max replies
$db->SetQuery("SELECT uid,username,replies FROM #@__group_user WHERE gid='{$id}' ORDER BY replies DESC LIMIT 0,5");
$db->Execute();
$replies = '';
while($rs = $db->GetArray()){
	$replies .= "<li><a href='{$cfg_member_dir}/index.php?id=".$rs['uid']."' target=\"_blank\">".$rs['username']."</a> (".$rs['replies'].")</li>\n";
}
//Max posts
$db->SetQuery("SELECT uid,username,posts FROM #@__group_user WHERE gid='{$id}' ORDER BY posts DESC LIMIT 0,5");
$db->Execute();
$posts = '';
while($rs = $db->GetArray()){
	$posts .= "<li><a href='{$cfg_member_dir}/index.php?id=".$rs['uid']."' target=\"_blank\">".$rs['username']."</a> (".$rs['posts'].")</li>\n";
}
if(!isset($typeid)) $typeid = '';
//Small types
if(!isset($smalltype)) $smalltype = '0';
$smalltype = ereg_replace("[^0-9,]","",$smalltype);
$smalltypes = "";
$smalltype_array = array();
if($smalltype!='0'){
	$smalltype = @explode(",",$smalltype);
	if(is_array($smalltype)) $smalltype = array_filter($smalltype);
	$smalltype = @implode(",",$smalltype);
	if(empty($smalltype)) $smalltype = 0;
	$db->SetQuery("SELECT `id`,`smalltypes` FROM `#@__group_smalltypes` WHERE `userid`=".$userid." AND `id` IN(".$smalltype.") ORDER BY `disorder` ASC");
	$db->Execute();
	while($rs = $db->GetArray()){
		array_push($smalltype_array,$rs);
		$selected = "";
    if($typeid==$rs['id']) $selected = "style='color:red;'";
		$smalltypes .= "<dd><a href='groupdisplay.php?id={$id}&typeid=".$rs['id']."' ".$selected.">".$rs['smalltypes']."</a></dd>\n";
	}
}
?>
    <div id="group_class_left">
   	  <div class="group_classtitle_form">
       	<div class="group_classtitle_bg"><?php echo $lang['group_threads_smalltype'];?>
        </div>
            <div class="group_class_formtext">
           	  <dl>
                <dt><a href="groupdisplay.php?id=<?php echo $id;?>"><?php echo $lang['group_threads_all'];?></a></dt>
                <?php if(isset($smalltypes)) echo $smalltypes;?>
              </dl>
                <div class="clear">
                </div>
            </div>
      </div>
        <div class="group_classtitle_form">
       	  <div class="group_classtitle_bg"><?php echo $lang['group_member_active'];?>
            </div>
            <div class="group_class_formtext1">
            	<div class="subtitle">
               	  <ul id="subtitle">
					<li><a href="###"><?php echo $lang['group_member_posts'];?></a></li>
						<li><a href="###"><?php echo $lang['group_member_replys'];?></a></li>
					</ul>
                    <div class="clear">
                    </div>
                </div>
                <div id="replaytitle">
                	<dl>
                	<dt><?php echo $lang['group_notice_14'];?></dt>
						<dd>
                            <div class="group_member_class">
                           	  <div class="group_member_img">
                              </div>
                              	<div class="group_member_class_text1">
                               	  <ul>
                                    <?php echo $posts;?>
                                  </ul>
                                </div>
                                <div class="clear">
                                </div>
                            </div>
                            <div class="clear">
                            </div>
                        </dd>
						<dd>
                            <div class="group_member_class">
                            	<div class="group_member_img">
                                </div>
                              	<div class="group_member_class_text1">
                               	  <ul>
                                    <?php echo $replies;?>
                                  </ul>
                                </div>
                                <div class="clear">
                                </div>
                            </div>
                            <div class="clear">
                            </div>
                        </dd>
                  </dl>
                </div>
                <div class="clear">
                </div>
          </div>
        </div>
        
        <div class="group_classtitle_form">
        	<div class="group_classtitle_bg"><?php echo $lang['group_member_newjoin'];?>
            </div>
            <div class="group_class_formtext">
            	<ul>
                <?php echo $newmenber;?>
                </ul>
                <div class="clear">
                </div>
            </div>
      </div>

        <div class="group_classtitle_form">
       	  <div class="group_classtitle_bg"><?php echo $lang['group_guestbook_new'];?>
          </div>
            <?php
            $db->SetQuery("SELECT uname,message FROM #@__group_guestbook WHERE gid='{$id}' ORDER BY stime DESC LIMIT 0,5");
            $db->Execute();
            while($rs = $db->GetArray()){
			?>
          <div class="group_class_gbtext"><?php echo $rs['uname'];?><img src="images/forum01.gif" align="absmiddle" />:<?php echo cn_substr(trim(ClearHtml($rs['message'])),60);?> </div>
          <?php } ?>
            <div class="group_class_more">[<a href="guestbookform.php?id=<?php echo $id;?>"><?php echo $lang['group_guestbook_ipost'];?></a>] <a href="guestbook.php?id=<?php echo $id;?>"><?php echo $lang['group_main_more'];?></a>
            </div>
      </div>
    </div>